package com.woniu.service.impl;

import com.woniu.entity.Address;
import com.woniu.mapper.AddressMapper;
import com.woniu.service.AddressService;
import com.woniu.util.ResponseEnum;
import com.woniu.util.ResponseUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AddressServiceImpl implements AddressService {
    @Resource
    private AddressMapper addressMapper;
    @Override
    public ResponseUtil findByUserId(Integer customerId) {
        List<Address> all = addressMapper.findByUserId(customerId);
        return !all.isEmpty() ? ResponseUtil.get(ResponseEnum.OK, all)
                : ResponseUtil.get(ResponseEnum.FAIL);
    }
}
